<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
$this->load->helper('url');
?>	<table id="tt" class="easyui-datagrid"></table>
	
	<div id="tb" style="padding:10px;5px;height:auto">
		<div>
			编号: <input id="id" class="easyui-textbox" style="width:80px">
			用户名: <input id="username" class="easyui-textbox" style="width:100px">
			
			币种：
			<select id="coin_id" class="easyui-combobox" style="width:100px">
				<option value="0">全部</option>
				
<?php
foreach ($coins as $v) {
?>				<option value="<?php echo $v['id'];?>"><?php echo $v['cn_name'];?></option>
				<?php
}

?>			</select>
			<a href="#" onclick="doSearch()" class="easyui-linkbutton" iconCls="icon-search">搜索</a>
		</div>
		<div style="margin-top:10px">
		</div>
	</div>
	
	<div id="win"></div>

<script language="javascript">
function doSearch(){
	$('#tt').datagrid('load',{
		id: $('#id').val(),
		username: $('#username').val(),

		coin_id: $('#coin_id').val()
	});
}
$(function(){
	$('#tt').datagrid({
		url:'<?php echo site_url('xnb/data');?>',
		pagination:true,
		toolbar:'#tb',
		pageSize:20,
		checkbox:true,
		fit:true,
		fitColumns:true,
		border:false,
		idField:'id',
		nowrap:true,
		autoRowHeight:true,
		'columns':[[
			{field:'ck',checkbox:'true'},
			{field:'id',width:'9%',title:'编号'},
			{field:'coin_name',width:'9%',title:'币种'},
			{field:'username',width:'13%',title:'帐号'},
			{field:'num',width:'13%',title:'可用数量'},
			{field:'num_frozen',width:'13%',title:'冻结数量'},
			{field:'total',width:'13%',title:'总数量'},
			{field:'address',width:'13%',title:'充值地址'},
			{field:'action',width:'15%',title:'操作',formatter:function(value,row,index){return '<a href="javascript:doinfo('+row.user_id+')" iconCls="icon-search" class="list_link easyui-linkbutton">查看用户</a> <a href="javascript:dofill('+row.id+')" iconCls="icon-add" class="list_link easyui-linkbutton">编辑</a>';}}
		]],
		onLoadSuccess:function(data){$(".list_link").linkbutton()}
	});
});

function doinfo(id){

	$('#win').window({
		width:500,
		height:400,
		modal:true,
		closed:true,
		title:'用户信息'
	});
	
	$('#win').window('open');
	$('#win').window('refresh', '<?php echo site_url('xnb/info/\'+id+\'');?>');
}

function dofill(id){

	$('#win').window({
		width:500,
		height:200,
		modal:true,
		closed:true,
		title:'充值'
	});
	
	$('#win').window('open');
	$('#win').window('refresh', '<?php echo site_url('xnb/fill/\'+id+\'');?>');
}

</script>